import request from './request'

// 获取我的评价列表
export function getMyReviews(params) {
  return request({
    url: '/reviews/my',
    method: 'get',
    params
  })
}

// 获取待评价的订单列表
export function getPendingReviewOrders(params) {
  return request({
    url: '/reviews/pending/orders',
    method: 'get',
    params
  })
}

// 获取待评价的设计师列表
export function getPendingReviewDesigners(params) {
  return request({
    url: '/reviews/pending/designers',
    method: 'get',
    params
  })
}

// 提交产品评价
export function submitProductReview(data) {
  return request({
    url: '/reviews/product',
    method: 'post',
    data
  })
}

// 提交设计师评价
export function submitDesignerReview(data) {
  return request({
    url: '/reviews/designer',
    method: 'post',
    data
  })
}

// 更新评价
export function updateReview(id, data) {
  return request({
    url: `/reviews/${id}`,
    method: 'put',
    data
  })
}

// 删除评价
export function deleteReview(id) {
  return request({
    url: `/reviews/${id}`,
    method: 'delete'
  })
}

// 获取评价详情
export function getReviewDetail(id) {
  return request({
    url: `/reviews/${id}`,
    method: 'get'
  })
}

// 获取产品评价统计
export function getProductReviewStats(productId) {
  return request({
    url: `/reviews/stats/product/${productId}`,
    method: 'get'
  })
}

// 获取设计师评价统计
export function getDesignerReviewStats(designerId) {
  return request({
    url: `/reviews/stats/designer/${designerId}`,
    method: 'get'
  })
}

// 获取产品评价列表
export function getProductReviews(productId, params) {
  return request({
    url: `/reviews/product/${productId}`,
    method: 'get',
    params
  })
}

// 获取设计师评价列表
export function getDesignerReviews(designerId, params) {
  return request({
    url: `/reviews/designer/${designerId}`,
    method: 'get',
    params
  })
}

// 获取产品评价详情
export function getProductReviewDetail(id) {
  return request({
    url: `/reviews/product/${id}`,
    method: 'get'
  })
}

// 获取设计师评价详情
export function getDesignerReviewDetail(id) {
  return request({
    url: `/reviews/designer/${id}`,
    method: 'get'
  })
}

// 获取产品详情（用于评价）
export function getProductForReview(id) {
  return request({
    url: `/products/${id}/review-info`,
    method: 'get'
  })
}

// 获取设计师详情（用于评价）
export function getDesignerForReview(id) {
  return request({
    url: `/designers/${id}/review-info`,
    method: 'get'
  })
}

// 上传评价图片
export function uploadReviewImage(data) {
  return request({
    url: '/upload/review-image',
    method: 'post',
    data,
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
} 